package com.ycsyxt;

/**
 * @author ycs
 **/
public class Main {
    public static void main(String[] args) {
        long start1 = System.currentTimeMillis();
        System.out.println(String.format("%d", getGrid(16)));
        long end1 = System.currentTimeMillis();
        System.out.println(end1 - start1);
        long start2 = System.currentTimeMillis();
        System.out.println(String.format("%d", (1 << 16) - 1));
        long end2 = System.currentTimeMillis();
        System.out.println(end2 - start2);
    }

    public static long getGrid(int grid) {
        int start = 1;
        long sum = 0L;
        for (int i = 1; i <= grid; i++) {
            sum += start;
            start *= 2;
        }
        return sum;
    }
}
